Hello All, with below code I can search for specific text in Word Object:
Object o = current Object
string sKeyword = "Test Cases"
OleAutoObj objDoc = null, objApp = null, objSelection = null, objFind = null
bool bIsStatic
bool bFoundKeyword = false
bool bIsActivated = false
string sErr, sName
if (containsStaticOle(o."Object Text")) print(bFoundKeyword)
if (containsUnregisteredOle(o."Object Text")) print(bFoundKeyword)
if (oleCount(o."Object Text") < 1) print(bFoundKeyword)
bIsActivated = oleActivate(o)
if (!bIsActivated) print(bFoundKeyword)
objDoc = oleGetAutoObject(o)
if (null(objDoc))
{
oleDeactivate(o)
print(bFoundKeyword)
}
oleGet(objDoc, "Application", objApp)
if (null(objApp))
{
if (!null(objDoc)) oleCloseAutoObject(objDoc)
oleDeactivate(o)
print(bFoundKeyword)
}
oleGet(objApp, "Name", sName)
if (!matches("Word", sName))
{
// not a word application, so close out and print
oleDeactivate(o)
print(bFoundKeyword)
}
oleGet(objApp, "Selection", objSelection)
oleGet(objSelection, "Find", objFind)
oleMethod(objFind, "ClearFormatting")
olePut(objFind, "Text", sKeyword)
olePut(objFind, "MatchCase", false)
olePut(objFind, "MatchWholeWord", false)
olePut(objFind, "MatchWildcards", true)
olePut(objFind, "Format", false)
oleMethod(objFind, "Execute")
oleGet(objFind, "Found", bFoundKeyword)
That part works fine. Now I want move one cell to the right (found text is inside table cell). I wrote something like that:
OleAutoArgs arg = null
arg = create
put(arg,"Unit","wdCell")
put(arg,"Count",1)
print(oleMethod(objFind, "MoveRight",arg))
but always end up with: "Problem with OLE Argument names." Maybe someone could help me with that.
Best Regards, Mateusz matosz17 - Fri Jan 31 03:29:04 EST 2014 |
Re: MoveRight method on Word OLE object. DOORS does not know about the numeric constants in Word and also does normally not care about argument names. To find the numeric expression for 'wdCell' open the Word VBA Editor, and type in the console: "? wdCell" which gives you "12". Then you translate to DXL: ... put (args, 12) // wdCell put (args, 1) // count put (args, 0) // wdMove oleMethod (objFind, "MoveRight", arg) ... Hope this helps, regards, Mathias |